<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Category extends Model
{
    use HasFactory;
    //允许批量赋值的字段

    protected $fillable = ['pid','name','level','group'];

    public function children()
    {
        return $this->hasMany(Category::class,'pid','id');
    }
}
